<!DOCTYPE html>
<svg xmlns="http://www.w3.org/2000/svg" style="width: 135px; height: 45px;">
  <text y="16" x="70" direction="rtl" id="t">0 - blah(1)</text>
</svg>

<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>
test(() => {
  const text = document.getElementById('t');
  const zero = text.getStartPositionOfChar(0);
  const dash = text.getStartPositionOfChar(2);
  const b = text.getStartPositionOfChar(4);
  const open = text.getStartPositionOfChar(8);
  const one = text.getStartPositionOfChar(9);
  const close = text.getStartPositionOfChar(10);
  let points = [zero, dash, b, open, one, close];
  points.sort((a, b) => a.x - b.x);
  // The order should be: b, (, 1, ), -, 0
  assert_array_equals(points, [b, open, one, close, dash, zero]);
}, 'Correctness of bidi reordering');
</script>

